#nullable enable

using System.Threading.Tasks;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Logging;
using PHMEE.DTOS.Diagnosis;
using PHMEE.Managers.Diagnosis;
using Volo.Abp.DependencyInjection;
using Volo.Abp.EventBus;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.Uow;

namespace PHMEE.Services.Diagnosis;

// /// <summary>
// /// 报警记录确认事件 Handler
// /// </summary>
// public class AlarmRecordAckedEventHandler : ILocalEventHandler<AlarmRecordAckedEto>, ITransientDependency
// {
//     private readonly ILogger<AlarmRecordAckedEventHandler> _logger;
//     private readonly IHubContext<AlarmRecordRealtimeHub, IAlarmRecordRealtimeClient> _alarmRecordRealtimeHub;
//
//     public AlarmRecordAckedEventHandler(ILogger<AlarmRecordAckedEventHandler> logger,
//         IHubContext<AlarmRecordRealtimeHub, IAlarmRecordRealtimeClient> alarmRecordRealtimeHub)
//     {
//         _logger = logger;
//         _alarmRecordRealtimeHub = alarmRecordRealtimeHub;
//     }
//     
//     [UnitOfWork]
//     public async Task HandleEventAsync(AlarmRecordAckedEto eventData)
//     {
//         _logger.LogDebug("处理报警确认 Handler: {0}", eventData.Id);
//
//         var alarmRecordAckedRealtimeDto = new AlarmRecordAckedRealtimeDto
//         {
//             AlarmRecordId = eventData.Id,
//             UnitId = eventData.UnitId,
//             EquipId = eventData.EquipId,
//             IsAcked = eventData.IsAcked
//         };
//         
//         await _alarmRecordRealtimeHub.Clients.Group(eventData.UnitId.ToString()).AlarmAcked(alarmRecordAckedRealtimeDto);
//     }
// }